﻿#ifndef NSSHARE_SYS_REGISTRY_H_
#define NSSHARE_SYS_REGISTRY_H_

#include "../platform.h"
#include "../utils/disallow_copy_and_assign.h"
#include "../utils/bitwise_enum.h"

namespace nsshare
{

namespace sys
{

class Registry
{
public:
    static bool CreateAsNonPrivilege(const char * path);

    static bool Create(const char * path);

    static bool Delete(const char * path);

    Registry();

    ~Registry();

    bool Open(const char * name, const char * mode);

    void Close();

    bool Write(const char * name, uint32_t value);

    bool Write(const char * name, int32_t value);

    bool Write(const char * name, const std::string & value);

    bool Write(const char * name, const char * value);

    bool Read(const char * name, std::string & value);

    bool Read(const char * name, uint32_t & value);

    bool Read(const char * name, int32_t & value);

    bool Remove(const char * name);
private:
    DISALLOW_COPY_AND_ASSIGN(Registry);
private:
#ifdef NSSHARE_WINDOWS
    HKEY key_;
#endif
};

}
}

#endif